home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / PROGTOOL / FGL304E.ZIP;1 / EXPAS.ARJ / FGDOC / EXAMPLES / PASCAL / 05-16.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-01-24  |  1.6 KB  |  83 lines

  1. program main;
  2. uses fgmain, fgmisc;
  3.  
  4. var
  5.   mode, old_mode : integer;
  6.   message        : string[5];
  7.  
  8. begin
  9.  
  10. { Ask for the video mode number }
  11.  
  12.   write('Which video mode? ');
  13.   read(mode);
  14.  
  15. { Make sure the entered value is valid }
  16.  
  17.   if (mode < 0) or (mode > 29) then
  18.   begin
  19.     writeln(mode,' is not a valid video mode number.');
  20.     exit;
  21.   end;
  22.  
  23. { Make sure the requested video mode is available }
  24.  
  25.   if (fg_testmode(mode,1) = 0) then
  26.   begin
  27.     writeln('Mode ',mode,' is not available on this system.');
  28.     exit;
  29.   end;
  30.  
  31. { Establish the video mode }
  32.  
  33.   old_mode := fg_getmode;
  34.   fg_setmode(mode);
  35.  
  36. { Perform mode-specific initializations }
  37.  
  38.   if (mode <= 3) or (mode = 7) then     { text modes }
  39.     fg_cursor(0)
  40.  
  41.   else if (mode = 4) or (mode = 5) then { CGA color modes }
  42.   begin
  43.     fg_palette(0,0);
  44.     fg_defcolor(14,3);
  45.   end
  46.  
  47.   else if (mode = 6) then      { CGA two-color mode }
  48.   begin
  49.     fg_palette(0,14);
  50.     fg_defcolor(14,1);
  51.   end
  52.  
  53.   else if (mode = 11) then     { Hercules mode }
  54.     fg_defcolor(14,1)
  55.  
  56.   else if (mode = 12) then     { Hercules low-res mode }
  57.     fg_defcolor(14,3)
  58.  
  59.   else if (mode = 17) then     { VGA two-color mode }
  60.   begin
  61.     fg_palette(1,14);
  62.     fg_setrgb(14,63,63,21);
  63.     fg_defcolor(14,1);
  64.   end;
  65.  
  66. { Display a message that includes the video mode number }
  67.  
  68.   fg_setcolor(14);
  69.   fg_text('I''m running in mode ',20);
  70.   str(mode,message);
  71.   message := message + '. ';
  72.   fg_text(message,3);
  73.  
  74. { Wait for a keystroke }
  75.  
  76.   fg_waitkey;
  77.  
  78. { Restore the original video mode and screen attributes }
  79.  
  80.   fg_setmode(old_mode);
  81.   fg_reset;
  82. end.
  83.